<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:ubb="http://java.sun.com/jsf/composite/components">

    <p:dataTable value="#{groupManager.groups}" var="group" emptyMessage="#{msg['adminPage.userManagement.groups.emptyTable']}..."
                 filteredValue="#{groupManager.filteredGroups}" rendered="#{administrationView.activePanel == 'LIST_USER_GROUPS'}" rowIndexVar="groupIndex">
        <p:columnGroup type="header">
            <p:row>
                <p:column headerText="#{msg['adminPage.userManagement.groups.groupName']}" style="width: 30%" />
                <p:column colspan="2" headerText="#{msg['adminPage.userManagement.groups.roles']}" />
            </p:row>
            <p:row>
                <p:column filterBy="#{group.groupName}" filterMatchMode="contains" />
                <p:column colspan="2" filterBy="#{groupManager.getRoles(group)}" filterMatchMode="contains" />
            </p:row>
        </p:columnGroup>
        <p:column>
            <h:outputText value="#{group.groupName}" />
        </p:column>
        <p:column>
            <h:outputText value="#{groupManager.getRoles(group)}"/>
        </p:column>
        <p:column styleClass="actions">
            <p:commandLink action="#{groupManager.edit(group)}" update="@form" >
                <h:graphicImage library="images" name="edit-16.png" />
                <h:outputText value="#{msg['Common.edit']}" />
            </p:commandLink>
            <p:commandLink onclick="confirmGroupDelete#{groupIndex}.show();return false;">
                <h:graphicImage library="images" name="trash-16.png" />
                <h:outputText value="#{msg['Common.delete']}" />
            </p:commandLink>
            <p:commandLink id="deleteGroup" action="#{groupManager.delete(group)}" update="@form" value="Execute" style="display: none" />
            <ubb:confirmationDialog title="#{msg['adminPage.userManagement.groups.delete.confirmationTitle']}" message="#{msg['adminPage.userManagement.groups.delete.confirmationMessage']}"
                                    actionButtonId="#{p:component('deleteGroup')}" widgetVar="confirmGroupDelete#{groupIndex}" />
        </p:column>
    </p:dataTable>
    <h:panelGroup rendered="#{administrationView.activePanel == 'LIST_USER_GROUPS'}" layout="block" styleClass="buttonPanel">
        <p:commandButton value="#{msg['adminPage.userManagement.groups.createNew']}" action="#{administrationView.switchPanel('NEW_USER_GROUP')}" update="@form" icon="add" process="@this" />
        <p:commandButton value="#{msg['Common.cancel']}" action="#{administrationView.switchPanel('DESCRIPTION')}" update="@form" icon="cancel" process="@this" />
    </h:panelGroup>
</ui:composition>